<template>
  <div>
    <el-card class="box-card">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="用户名">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="用户密码">
          <el-input v-model="form.password"></el-input>
        </el-form-item>
        <el-form-item label="姓名">
          <el-input v-model="form.realName"></el-input>
        </el-form-item>
        <el-form-item label="性别">
          <el-select v-model="form.sex" placeholder="选择用户类型">
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="用户类型">
          <el-select v-model="form.role" placeholder="选择用户类型">
            <el-option label="管理员" value="1"></el-option>
            <el-option label="服务台员" value="2"></el-option>
            <el-option label="药剂师" value="3"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="职称">
          <el-select v-model="form.positional" placeholder="选择用户类型">
            <el-option label="管理员" value="1"></el-option>
            <el-option label="服务台员" value="2"></el-option>
            <el-option label="药剂师" value="3"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="form.tel"></el-input>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input v-model="form.age"></el-input>
        </el-form-item>


        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
  import {findById} from '@/network/duty'

  export default {
    name: 'DrugEdit',
    created() {
      this.getUser()
    },
    methods: {
      getUser() {
        findById(window.sessionStorage.getItem("ddid")).then(res => {
          console.log(res)
        })
      },
      onSubmit() {
        edit(this.form).then(res => {
          this.$router.back(1)
        })
      },
      cancel() {
        this.$router.back(1)
      }
    },
    data() {
      return {
        form: {
        }
      }
    }
  }
</script>

<style scoped>

</style>
